package com.tanhua.dubbo.api;

import com.tanhua.model.mongo.Conclusion;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

@DubboService
public class ConclusionApiImpl implements ConclusionApi{
    @Autowired
    private MongoTemplate mongoTemplate;

    @Override
    public Conclusion findByScore(Integer userScore) {
        Query query = Query.query(Criteria.where("conclusionScore").is(userScore));
        Conclusion conclusion = mongoTemplate.findOne(query, Conclusion.class);


        return conclusion;
    }
}
